import http from '@/utils/http';
import {postAjax} from '@/utils/axios';

/**
 * 获取质检任务列表
 * @param params
 * @returns {*|Promise<any>}
 */
export const getTaskList = (params?: any) => {
    return http.get('inspect/task/search', {params});
}

/**
 * 获取质检任务详情
 * @param params
 * @returns {*|Promise<any>}
 */
export const getTaskDetail = (params?: any) => {
    return http.get('inspect/task/'+params.taskId);
}

/**
 * 获取质检任务质检次数
 * @param params
 * @returns {*|Promise<any>}
 */
export const queryTaskInspectTimes = (params?: any) => {
    return http.get('inspect/result/queryTimesByTask/'+params.taskId);
}

/**
 * 开启质检
 * @param params
 * @returns {*|Promise<any>}
 */
export const startTaskInspect = (params?: any) => {
    return postAjax('inspect/task/startInspect',params);
}

/**
 * 查询质检结果摘要信息
 * @param params
 * @returns {*|Promise<any>}
 */
export const queryResultSummarize = (params?: any) => {
    return http.get('inspect/result/queryResultSummarize/'+params.resultId);
}

/**
 * 查询质检结果统计-按质检规则
 * @param params
 * @returns {*|Promise<any>}
 */
export const queryResultStatisticsByRule = (params?: any) => {
    return http.get('inspect/result/queryResultStatisticsByRule/'+params.resultId);
}

/**
 * 查询质检结果统计-按质检区域
 * @param params
 * @returns {*|Promise<any>}
 */
export const queryResultStatisticsByArea = (params?: any) => {
    return http.get('inspect/result/queryResultStatisticsByArea/'+params.resultId);
}

/**
 * 生成质检报告
 * @param params
 * @returns {*|Promise<any>}
 */
export const generatedResultReport = (params?: any) => {
    return http.post('inspect/result/generatedReport',params);
}

/**
 * 反馈质检结果
 * @param params
 * @returns {*|Promise<any>}
 */
export const feedbackInspectResult = (params?: any) => {
    return postAjax('inspect/result/feedbackResult',params);
}

/**
 * 查询质检任务的质检报告ID
 * @param params
 * @returns {*|Promise<any>}
 */
export const getReportFileId = (params?: any) => {
    return http.get('inspect/result/getReportFileId/'+params.resultId);
}

/**
 * 查询质检任务最新一次的质检结果报告文件ID
 * @param params
 * @returns {*|Promise<any>}
 */
export const getLatestReportFileId = (params?: any) => {
    return http.get('inspect/task/getLatestReportFileId/'+params.taskId);
}

/**
 * 按规则、部门查询质检结果明细
 * @param params
 * @returns {*|Promise<any>}
 */
export const queryResultDetailList = (params?: any) => {
    return http.get('inspect/result/detail/queryDetailList', {params});
}

/**
 * 查询质检结果校验的填报数据ID-人工质检
 * @param params
 * @returns {*|Promise<any>}
 */
export const queryResultDetailDataId = (params?: any) => {
    return http.get('/inspect/result/queryResultDetailDataId/'+params.inspectResultId);
}

/**
 * 查询质检结果、填报数据的校验失败明细-人工质检
 * @param params
 * @returns {*|Promise<any>}
 */
export const queryResultDataDetail = (params?: any) => {
    return http.get('inspect/result/detail/queryResultDataDetail', {params});
}

/**
 * 更新质检结果明细
 * @param params
 * @returns {*|Promise<any>}
 */
export const updateResultDetail = (params?: any) => {
    return http.put('inspect/result/detail',params);
}

export const validateData = (params?: any) => {
    return postAjax('inspect/task/validateData',params);
}

/**
 * 查询填报数据最新的校验失败明细-数据核查
 * @param params
 * @returns {*|Promise<any>}
 */
export const queryResultDetailByDataId = (params?: any) => {
    return http.get('inspect/result/detail/queryResultDetailByDataId', {params});
}
